﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="">
//   
// </copyright>
// <summary>
//   The program.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace TinyRadio.UserInterface
{
    using System;
    using System.Threading;
    using System.Windows;

    using TinyRadio.UserInterface.Views;

    /// <summary>The program.</summary>
    internal class Program
    {
        #region Constants

        /// <summary>The application GUID.</summary>
        private const string AppGuid = "b8cd15ae-63a6-4de2-b564-ac8ce9e51a64";

        #endregion

        #region Public Methods and Operators

        /// <summary>The main.</summary>
        [STAThread]
        public static void Main()
        {
            var app = new Application();

            // make sure the app has only one instance.
            using (var mutex = new Mutex(false, @"Global\" + AppGuid))
            {
                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show("Tiny Radio is already running.");
                    return;
                }

                app.Run(new RadioPlayerWindow());
            }
        }

        #endregion
    }
}